//  0.引入异步对象
import request from "@/utils/request"

// 1.引入接口
// 再vscode当中引入接口对象的时候，要加上type来声明一下
import type { TrademarkListDataModel,TrademarkModel } from "./model/trademarkModel"

// 2. 添加枚举，统一管理接口
enum Api {
  // 1. 获取品牌列表数据
  getTrademarkListApi = '/admin/product/baseTrademark',
  // 2. 添加品牌
  saveTrademarkApi = '/admin/product/baseTrademark/save',
  // 3. 删除品牌
  deleteTrademarkApi = '/admin/product/baseTrademark/remove',
  // 4. 更新品牌
  updateTrademarkApi = '/admin/product/baseTrademark/update'
}

// 3. 获取品牌管理数据
export const reqGetTrademarkListData = (page: number, limit: number) => {
  // return request.get<any,TrademarkListDataModel>(`/${page}/${limit}`)
  return request.get<any,TrademarkListDataModel>(`${Api.getTrademarkListApi}/${page}/${limit}`)
}

// 4. 添加品牌
export const reqSaveTrademarkInfo = (trademark:TrademarkModel) =>{
  return request.post<any,null>(Api.saveTrademarkApi,trademark)
}

// 5. 删除品牌
export const reqDeleteTrademarkInfo = (id:number)=>{
  return request.delete<any,null>(`${Api.deleteTrademarkApi}/${id}`)
}

// 6. 更新品牌
export const reqUpdateTrademarkInfo = (trademark:TrademarkModel)=>{
  return request.put<any,null>(Api.updateTrademarkApi,trademark)
}
